// Copyright (C) ZHENG Zhong <heavyzheng nospam-at gmail D0T com>
//
// $Id: utility.hpp 210 2008-08-28 10:10:41Z heavyzheng $
//

#ifndef ZZHENG_XML_DOM_UTILITY_HPP_20080722__
#define ZZHENG_XML_DOM_UTILITY_HPP_20080722__

#include <zzheng/xml/config.hpp>
#include <zzheng/xml/dom/basic_node_ptr.hpp>
#include <string>

namespace zzheng {
namespace xml {
namespace dom {

    template<class Node>
    inline
    basic_node_ptr<Node> make_clone(const Node& n, bool recursive) {
        basic_node_ptr<node> cloned = n.clone(recursive);
        return dynamic_node_cast<Node>(cloned);
    }

    //! Checks if an XML element is ancestor of another XML node.
    //! \param ancestor  the element node to check.
    //! \param child     the child node to check.
    //! \return true if the element node is ancestor of the child node.
    //! \todo TODO: implement me!
    template<class Element, class Node>
    inline
    bool is_ancestor(const Element& ancestor, const Node& child);

} // namespace zzheng::xml::dom
} // namespace zzheng::xml
} // namespace zzheng

#endif // ZZHENG_XML_DOM_UTILITY_HPP_20080722__



